<template>
	<view class="count">
		<view class="top f f-a-c">
			门店书籍总数：{{total}}本
		</view>
		<view class="body p-20">
			<view v-for="(item,index) in list" :key="index" class="item p-20 b-f m-b-20 b-r-20">
				<view class="tops f f-a-c">
					<view class="lefB m-r-10"></view>
					<view class="book">
						{{item.name}}
					</view>
				</view>
				<view class="title">
					书籍总数：{{item.book_num}}本
				</view>
			</view>
		</view>
		<image @click="jieyue" src="/static/jieyue.png" class="jieyue" mode=""></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				total: ''
			}
		},
		onShow() {
			this.initList()
		},
		onReachBottom() {
			if (this.total == this.list.length) return
			console.log('1223456');
		},
		methods: {
			async initList() {
				let n = await this.$api.stat()
				this.total = n.data.total_num
				this.list = [...n.data.categories]
			},
			jieyue() {
				// 跳转到借阅统计
				uni.navigateTo({
					url: '/pageC/LoanStatistics'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.jieyue {
		position: fixed;
		width: 140rpx;
		height: 140rpx;
		bottom: 200rpx;
		right: 10rpx;
	}

	.item {
		.title {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Medium;
			font-weight: 500;
			text-align: left;
			color: #666666;
			margin-top: 15rpx;
		}

		.book {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #1a1a1a;
		}

		.lefB {
			width: 5rpx;
			height: 26rpx;
			background: #009d85;
		}
	}

	.top {
		padding: 0 20rpx;
		height: 95rpx;
		width: 100%;
		background-color: #fff;
		font-size: 30rpx;
		font-family: PingFang SC, PingFang SC-Bold;
		font-weight: 700;
		color: #333333;
	}
</style>